<template>
  <div class="view-container">

    <table-search-view :search-items="searchItems" :table-items="tableItems" :search-function="search">
      <template slot="action" slot-scope="scope">
        <action-info :scope="scope"></action-info>
      </template>
    </table-search-view>

  </div>
</template>

<script>
  import TableSearchView from '@/components/TableSearchView';

  import actionOrderInfo from './components/actionOrderInfo.vue';
  import {getOrderBuyoutFinishedList} from '@/api/order';

  export default {
    name: 'orderCompletedBuyout', /*买断完成*/
    components: {
      'table-search-view':TableSearchView,
      'action-info':actionOrderInfo,
    },
    data ()
    {
      return {
        searchItems: [
          {
            label: '商品名称',
            type: 'autocomplete',
            placeholder:'请输入商品名称',
            model:'goodName',
          },
          {
            label: '完成时间',
            type: 'datetimerange',
            placeholder:'请选择完成时间',
            model:'timeRange',
          },
          {
            label: '订单编号',
            type: 'input',
            placeholder:'请输入订单编号',
            model:'orderId',
          },
          {
            label: '下单用户',
            type: 'input',
            placeholder:'请输入下单用户',
            model:'userName',
          }
        ],
        tableItems:[
          {
            label:'订单编号',
            prop:'orderNumber',
            width:'180px;',
          },
          {
            label:'商品名称',
            prop:'goodsName',
            width:'180px;',
          },
          {
            label:'下单用户',
            prop:'userName',
            width:'100px;',
          },
          {
            label:'订单总金额',
            prop:'cost',
            sortable:true,
            width:'160px;',
            formatter:'parsePrice',
          },
          {
            label:'完成时间',
            prop:'finishedTime',
            width:'160px;',
            formatter:'parseTime',
          },
          {
            label:'订单状态',
            prop:'stateStr',
            width:'160px;',
          },
          {
            type:'scope',
            label:'操作',
            slot:'action',
          },

        ],
      }
    },
    methods: {
      search(data)
      {
        return getOrderBuyoutFinishedList(data);
      }
    }
  }
</script>
